package com.toune.movie.mvp.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.avos.avoscloud.AVObject;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.toune.movie.R;
import com.toune.movie.base.BaseActivity;
import com.toune.movie.base.myUtil.GetTimeUtils;

import java.util.List;

public class AdapterForum extends BaseQuickAdapter<AVObject, BaseViewHolder> {
    public AdapterForum(int layoutResId, @Nullable List<AVObject> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AVObject data) {
        helper.setText(R.id.title_tv,data.getString("title"));
        helper.setText(R.id.update_time_tv,GetTimeUtils.date2String(data.getDate("updatedAt")));
        helper.setText(R.id.content_tv,data.getString("content"));
        helper.setText(R.id.author_tv,data.getString("author"));
        Glide.with(mContext).load(data.getString("imgUrl")).apply(new RequestOptions().placeholder(R.mipmap.holder).error(R.mipmap.holder)).into((ImageView) helper.getView(R.id.img_iv));
    }
}
